package sun.curriculumschedule;

/**
 * Created by JohnSun on 2016/1/28.
 */
public class SectionUtil {
    private int whichDayOfWeek;//星期几
    private int sectionOfDay;//第几节


    /**
     *   根据 position 确定 周几 ,第几节 日期 等
     */
    public static SectionUtil getSectionDetail(int position){
        SectionUtil oneSection=new SectionUtil();
          int dayOfWeek=position%5+1;
          int section=(int)position/5+1;
          oneSection.setSectionOfDay(section);
          oneSection.setWhichDayOfWeek(dayOfWeek);
        return oneSection;
    }

    public  static int getPosition(int dayOfWeek,int section) {

        int position=(dayOfWeek-1)+(section-1)*5;
        return position;
    }


    public int getSectionOfDay() {
        return sectionOfDay;
    }

    public void setSectionOfDay(int sectionOfDay) {
        this.sectionOfDay = sectionOfDay;
    }


    public int getWhichDayOfWeek() {
        return whichDayOfWeek;
    }

    public void setWhichDayOfWeek(int whichDayOfWeek) {
        this.whichDayOfWeek = whichDayOfWeek;
    }

    @Override
    public String toString() {
        return "SectionUtil{" +
                ", whichDayOfWeek=" + whichDayOfWeek +
                ", sectionOfDay=" + sectionOfDay +
                '}';
    }
}
